package com.androidtest3d.math;

/**
 * Android Game Tutorial Project.
 *
 * Copyright (C) 2011  Philipp Jenke
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Contains various helper classes.
 */
public final class MathHelpers {

	/*
	 * Numerical precision.
	 */
	private static final double EPSILON = 0.0000001;

	/**
	 * Dimension 2.
	 */
	private static final int DIMENSION_2 = 2;

	/**
	 * Dimension 3.
	 */
	private static final int DIMENSION_3 = 3;

	/**
	 * Dimension 4.
	 */
	private static final int DIMENSION_4 = 4;

	/**
	 * 180 degrees.
	 */
	private static final double HALF_CIRCLE_ANGLE = 180.0;

	/**
	 * Constructor.
	 */
	private MathHelpers() {
	}

	/**
	 * @return the dimension2
	 */
	public static int getDimension2() {
		return DIMENSION_2;
	}

	/**
	 * @return the dimension3
	 */
	public static int getDimension3() {
		return DIMENSION_3;
	}

	/**
	 * @return the dimension4
	 */
	public static int getDimension4() {
		return DIMENSION_4;
	}

	/**
	 * Convert a radiens angle to a degree angle.
	 * 
	 * @param radiens
	 * @return
	 */
	public static double radiens2degree(double radiens) {
		return radiens / Math.PI * HALF_CIRCLE_ANGLE;
	}

	/**
	 * Convert a degree angle to a radiens angle.
	 * 
	 * @param degree
	 * @return
	 */
	public static double degree2radiens(final double degree) {
		return degree / HALF_CIRCLE_ANGLE * Math.PI;
	}

	/**
	 * Getter.
	 * 
	 * @return
	 */
	public static double getEpsilon() {
		return EPSILON;
	}

}
